<extend name="./base" />
<block name="body">
    <table class="table">
      <caption>推荐列表</caption>
      <thead>
        <tr>         
          <th>推荐人电话</th>
          <th>被推荐人电话</th>
          <th>备注</th>
          <th>处理状态</th>
          <th>添加日期</th>
        </tr>
      </thead>
      <tbody>
      <?php  if($data){?>
      <foreach name="data" item="vo">
        <tr>
          <td>{$vo.user_phone}</td>
          <td>{$vo.phone}</td>
          <td>{$vo.remarks}</td>
                    <td>
              <select class="cl_status" data-id="{$vo.id}" >
                  <option value="0" <if condition="($vo.status eq 0) "> selected  </if> >待处理</option>
                  <option value="1" <if condition="($vo.status eq 1) "> selected  </if>>已处理</option>
              </select>
          </td>
          <td>{$vo.adddate}</td>          
        </tr>
     </foreach>   
     <?php }else{?>   
     <tr><td>暂无数据</td></tr>
      <?php }?>
      </tbody>
    </table>
    <div>
        {$render}
    </div>
<script type="text/javascript">
   $(".cl_status").change(function(){
        var this_id = $(this).data("id");
        var this_status=$(this).val(); 
        if ( confirm('你确定操作吗？') ) {
            $.ajax({
                type: "post",
                url: "__ROOT__/index.php/Admin/Teacher/dealIntroduction",
                dataType: 'json',
                data:{
                    id:this_id,
                    status:this_status,
                },
                success: function(result) {
                    if ( result.flag == 1) {
                        alert('操作成功!');                      
                    } else{
                        alert('操作失败!');   
                    }
                }
            })
        }
    });
</script>
</block>